import HTTP from "../utils/http-p.js"

class BookModel extends HTTP{
    constructor(props){
        super(props)
    }
    getHotList(){
        return this.request({
            url: "/book/hot_list"
        })
    }

    getMyBookCount(){
        return this.request({
            url: "/book/favor/count"
        })
    }
    // 获取图书详情
    getDetail(bid) {
        return this.request({
            url: `/book/${bid}/detail`
        })
    }
    // 获取图书点赞状态
    getLikeStatus(bid){
        return this.request({
            url: `/book/${bid}/favor`
        })
    }
    // 获取图书短评信息
    getComments(bid){
        return this.request({
            url: `/book/${bid}/short_comment`
        })
    }
    // 提交短评
    postComment(bid, comment) {
        return this.request({
            method: 'POST',
            url: '/book/add/short_comment',
            data: {
                book_id: bid,
                content: comment
            }
        })
    }
    // 搜索图书
    search(start, q){
        return this.request({
            url: '/book/search?summary=1',
            data: {
                q,
                start
            }
        })
    }
    // 获取喜欢书籍列表
    getMyBookCount(){
        return this.request({
            url: '/book/favor/count'
        })
    }
}

export default BookModel